package edu.uniquindio.prmaven.proyectofinal;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
import org.testng.annotations.Test;

import edu.uniquindio.prmaven.general.TestCore;

public class FiltroTabla_G extends TestCore{
	
	@Test()
		
		/**
		dataProviderClass = edu.uniquindio.prmaven.dataprovider.DataProviderFactory.class, 
		dataProvider = ConfigurationConstants.DP_FACTORY
		@DataProviderArguments(ConfigurationConstants.ESCENARIO
				+ ConfigurationConstants.EQUALS + DataProvidersConstants.HOJA_1)
				**/
		public void testFiltroTabla_G() throws Exception {
		
		try{
			selenium.open("/showcase/");
			
			//selenium.click("css=#SubMenu-Data > span.MainLinkText"); Seleccion menu Data
			WebElement menu=driver.findElement(By.cssSelector("#SubMenu-Data > span.MainLinkText"));
			menu.click();
			
			//selenium.click("link=• DataTable"); Seleccion Submenu Datatable
			WebElement submenu=driver.findElement(By.xpath("//*[@id='MENUSIDEindent']/div[5]/a[5]"));
			submenu.click();
			
			selenium.waitForPageToLoad("30000");
			
			//selenium.click("link=• Filter"); Seleccion Opcion Filter
			WebElement texto=driver.findElement(By.xpath
					("//*[@id='CONTENTSIDEindent']/div[2]/ul/li[5]/a"));
			texto.click();
			
			selenium.waitForPageToLoad("30000");
			
			
			/*selenium.type("id=j_idt89:j_idt90:globalFilter", "Ye");
			 * xpath .//*[@id='j_idt89:j_idt90:globalFilter']
			 * Aplicar filtro general
			 */
			WebElement filtroGeneral=driver.findElement(By.xpath
					("//*[@id='j_idt89:j_idt90:globalFilter']"));
			filtroGeneral.sendKeys("Ye");
			
			Assert.assertEquals(selenium.getText("//tbody[@id='j_idt89:j_idt90_data']/tr/td[4]"), 
					"Yellow");

			selenium.waitForPageToLoad("30000");
			
				
		}catch(AssertionError e){
			System.out.println("no se encontro texto");
		}finally{
			
		}

	}
}



